<!DOCTYPE html>
<html>
<head>
	<title>借用构造函数</title>
</head>
<body>
<script type="text/javascript">
	
// 借用构造函数既可以继承实例中的属性和方法，也可以继承函数中的属性和方法

function Person(name) {
	this.name = name;
}
Person.prototype.say = function() {
	console.log(this.name);
}

function Student(name) {
	Person.call(this, name);
}
Student.prototype = new Person();
Student.prototype.constructor = Student;
let student = new Student('name');
student.say();

</script>
</body>
</html>